import java.util.Scanner;

public class Text {
    //给定一个字符串 s ，找到它的第一个不重复的字符，并返回它的索引 。如果不存在，则返回 -1 。
    //只含小写字母
    public static void main(String[] args) {
        int[] count = new int[26];
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int n = str.length();
        char ch = 0;
        for (int i = 0; i < n; i++) {
            ch = str.charAt(i);
            count[ch - 'a']++;
        }
        for (int i = 0; i < n; i++) {
            ch = str.charAt(i);
            if(count[ch - 'a'] == 1){
                System.out.println(i);
                break;
            }
        }
    }

    public static void main17(String[] args) {
        StringBuffer str = new StringBuffer("klklkl");
        str.append(666);
        System.out.println(str);
    }
    public static void main16(String[] args) {
        StringBuilder str = new StringBuilder("abcdefg ");
        System.out.println(str);
        str.reverse();
        System.out.println(str);
        str.append(12345).append(" hijkl ").append(14.25);
        System.out.println(str);
    }
    public static void main15(String[] args) {
        String s = "       I'm still fighting!          ";
        System.out.println("["+s.trim()+"]");
    }

    public static void main14(String[] args) {
        String s = "helloBit!";
        String ret = s.substring(5);
        String ret1 = s.substring(0,5);
        System.out.println(ret1);
        System.out.println(ret);
    }

    public static void main13(String[] args) {
        String s = "192\\452\\135\\1";
        System.out.println(s);
        String[] ret = s.split("\\\\");
        for(String ss : ret){
            System.out.println(ss);
        }
        String s1 = "192*452*135*1";
        System.out.println(s1);
        String[] ret1 = s1.split("\\*");
        for(String ss1 : ret1){
            System.out.println(ss1);
        }
    }

    public static void main12(String[] args) {
        String s = "Judy❤Nick❤They live together and forever!❤❤~~";
        String[] ret = s.split("❤",3);
        for(String ss : ret){
            System.out.println(ss);
        }
    }

    public static void main11(String[] args) {
        String s = "What do you do for a living?";
        String[] ret = s.split(" ");
        for(String ss : ret){
            System.out.print(ss+"   ");
        }
    }

    public static void main10(String[] args) {
        String s = "aapphsaaaueaaauaaaks";
        System.out.println(s.replaceAll("a","x"));
        System.out.println(s.replaceFirst("pp","XXX0000xxxx"));
    }

    public static void main9(String[] args) {
        String s1 = String.format("%d-%d-%d",2022,11,29);
        System.out.println(s1);
    }
    public static void main8(String[] args) {
        String s1 = "ooooooo";
        char[] ch = new char[s1.length()];
        ch = s1.toCharArray();
        for (int i = 0; i < s1.length(); i++) {
             System.out.print(ch[i]+" ");
        }
        System.out.println();
        String s2 = new String(ch);
        System.out.println(s2);
    }
    public static void main7(String[] args) {
        String s1 = "knock out";
        System.out.println(s1.toUpperCase());
        String s2 = "K.O.";
        System.out.println(s2.toLowerCase());
    }
    public static void main6(String[] args) {
        int a = Integer.parseInt("12345");
        double b = Double.parseDouble("12.66");
        System.out.println(a);
        System.out.println(b);
    }
    public static void main5(String[] args) {
        String s1 = String.valueOf(1234567);
        String s2 = String.valueOf(1234.567);
        String s3 = String.valueOf(true);
        String s4 = String.valueOf('A');
        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s3);
        System.out.println(s4);
    }
    public static void main4(String[] args) {
        String s = "ACDEFGHIJKABCDLMNOPQRBCDSTGHUVWSAYZ";
        System.out.println(s.charAt(15));
        System.out.println(s.indexOf('B'));
        System.out.println(s.indexOf('B',12));
        System.out.println(s.indexOf("BCD"));
        System.out.println(s.indexOf("BCD",20));
        System.out.println(s.lastIndexOf('A'));
        System.out.println(s.lastIndexOf('A',25));
        System.out.println(s.lastIndexOf("ABC"));
        System.out.println(s.lastIndexOf("GH",15));
    }

    public static void main3(String[] args) {
        String s1 = new String("oops");
        String s2 = new String("oops");
        String s3 = new String("oops!");
        String s4 = new String("Oops");
        System.out.println(s1.compareTo(s2));
        System.out.println(s2.compareTo(s3));
        System.out.println(s3.compareTo(s2));
        System.out.println(s2.compareTo(s4));
        System.out.println(s3.compareTo(s4));
        System.out.println(s2.compareToIgnoreCase(s4));



//        System.out.println(s1 == s2);
//        System.out.println(s2 == s3);
//        System.out.println(s1.equals(s2));
//        System.out.println(s2.equals(s3));
//        System.out.println(s2.equalsIgnoreCase(s3));
    }

    public static void main2(String[] args) {
        String s1 = new String("We'll meet again");
        String s2 = new String("We'll meet again");
        String s3 = new String("The oak tree");
        String s4 = s1;

        System.out.println(s1 == s2);
        System.out.println(s1 == s4);
        System.out.println(s2 == s3);

        //System.out.println("try everything".length());
    }
    public static void main1(String[] args) {
        //使用常量字符串构造
        String s = "She is a beauty";
        System.out.println(s);
        //直接 new String 对象
        String s1 = new String("Wow!");
        System.out.println(s1);
        //使用字符数组进行构造
        char[] ch = {'S','O','S'};
        String s2 = new String(ch);
        System.out.println(s2);
    }
}
